<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php 
	$ci = & get_instance(); 
?>
<?php if(!isset($id)): ?>
<form action="<?php echo site_url('admin/dataman/general/currency_submit');?>" name="currency_submit" id="currency_submit" method="post" enctype="multipart/form-data" >
	
	<div class="grid2"><span class="bold">*Code:</span></div>
	<div class="grid6"><input type="text" maxlength="10" id="code" name="code" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="code_error">Required field.</span></div>
<div class="clrboth"></div>		
	<div class="grid2"><span class="bold">*Name:</span></div>
	<div class="grid6"><input type="text" maxlength="20" id="name" name="name" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="name_error">Required field.</span></div>
<div class="clrboth"></div>		
	<div class="grid2"><span class="bold">*Rate:</span></div>
	<div class="grid6"><input type="text" maxlength="20" id="rate" name="rate" value="" class="std-input"/> /USD</div>
	<div class="grid2"><span class="bold red hidden" id="rate_error">Required field.</span></div>
<div class="clrboth"></div>	
	<div class="grid2"><span class="bold">Flag:</span></div>
	<div class="grid4"><?php echo form_upload('flag');?></div>
<div class="clrboth"></div>
	
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php else:?>
<form action="<?php echo site_url('admin/dataman/general/currency_submit');?>" name="currency_submit" id="currency_submit" method="post" enctype="multipart/form-data" >
	<?php 
		$CURRENCY = $ci->currency_entity->init('id',$id);
	?>
	<input type="hidden" name="id" value="<?php echo $CURRENCY->getId(); ?>" />
	<div class="grid2"><span class="bold">*Code:</span></div>
	<div class="grid6"><input type="text" maxlength="10" id="code" name="code" value="<?php echo $CURRENCY->getCode();?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="code_error">Required field.</span></div>
<div class="clrboth"></div>		
	<div class="grid2"><span class="bold">*Name:</span></div>
	<div class="grid6"><input type="text" maxlength="20" id="name" name="name" value="<?php echo $CURRENCY->getName();?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="name_error">Required field.</span></div>
<div class="clrboth"></div>		
	<div class="grid2"><span class="bold">*Rate:</span></div>
	<div class="grid6"><input type="text" maxlength="20" id="rate" name="rate" value="<?php echo $CURRENCY->getRate();?>" class="std-input"/> /USD</div>
	<div class="grid2"><span class="bold red hidden" id="rate_error">Required field.</span></div>
<div class="clrboth"></div>	
<div class="grid2"><span class="bold">Flag:</span></div>
	<div class="grid4"><?php echo form_upload('flag');?></div>
	<div class="grid2"><?php echo thumb($CURRENCY->getFileFlag(),30,30);?></div>
<div class="clrboth"></div>
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php endif;?>